Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: add s3 key name prefixes #202

Conversation

ericgriffis
Copy link
Contributor

Allows configuration of a key prefix for S3 uploads. This allows custom folders for uploads within your bucket, fulfilling #194.

Example of new configuration:

Capybara::Screenshot.s3_configuration = {
  ... # other config here
  key_prefix: "some/folder/"
}

@ericgriffis ericgriffis changed the title Feature/add s3 key name prefixes Feature: add s3 key name prefixes Feb 23, 2017
Copy link
Owner

@mattheworiordan mattheworiordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great PR, thanks for the contribution. I am really sorry it has taken me this long to respond to your PR, I have been bogged down. However, please see my comments before I can merge this.

.travis.yml Outdated
rvm:
- 2.0.0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you drop support for older versions of Ruby? This is as far as I can tell unrelated to this PR?

)

s3_client = Aws::S3::Client.new(s3_client_credentials)
bucket_name = configuration.fetch(:bucket_name)
bucket_name = configuration.delete(:bucket_name)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why delete as opposed to fetch. This will now mutate configuration which is a side effect of a class method. I don't understand why you would do this?

@@ -5,10 +5,11 @@ module Screenshot
class S3Saver
DEFAULT_REGION = 'us-east-1'

def initialize(saver, s3_client, bucket_name)
def initialize(saver, s3_client, bucket_name, key_prefix: nil)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This syntax is not compatible with older versions of Ruby. If I recall, we are not using named args like this anywhere else, so would prefer for not to remain consistent by using options = {}


new(saver, s3_client, bucket_name)
new(saver, s3_client, bucket_name, **configuration)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change to options for consistency, then you just pass in configuration?

@ericgriffis ericgriffis force-pushed the feature/add_s3_key_name_prefixes branch from d815085 to 6d94922 Compare April 3, 2017 16:42
@ericgriffis
Copy link
Contributor Author

@mattheworiordan Made the requested changes and rebased to master... Let me know if there's any other issues

@mattheworiordan
Copy link
Owner

Excellent, thank you very much for this contribution!

@mattheworiordan mattheworiordan merged commit 6e612dc into mattheworiordan:master Jul 12, 2017
@mattheworiordan
Copy link
Owner

This has now been released in v1.0.16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants